package club.zhilin.mall.config;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@OpenAPIDefinition(
        info = @Info(
                title = "网站-API文档",
                description = "本文档描述了网站微服务接口定义",
                version = "1.0",
                contact = @Contact(name = "zhilin", email = "1537372358@qq.com")
        )
)
public class SwaggerConfig {

    // 配置 Web API 分组
    @Bean
    public GroupedOpenApi webApi() {
        return GroupedOpenApi.builder()
                .group("webApi")
                .pathsToMatch("/api/**")
                .build();
    }

    // 配置 Admin API 分组
    @Bean
    public GroupedOpenApi adminApi() {
        return GroupedOpenApi.builder()
                .group("adminApi")
                .pathsToMatch("/admin/**")
                .build();
    }

}
